import { combineReducers } from 'redux';
import { OPEN_MODAL, ADD_LIST_ITEM } from './constant';
const initialState = {
  open: false,
  opened: 0,
  list: [],
  listId: null,
};
const modals = (state = initialState, action) => {
  switch (action.type) {
    case OPEN_MODAL:
      return Object.assign({}, state, {open: true, opened: state.opened++});
    case ADD_LIST_ITEM:
      return {...state, list: [...state.list, action.payload]}
    default:
      return state;
  }

};
export default combineReducers({
  modals
});
